#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :database.py
# @Time      :2021/6/20 19:02
# @Author    : 刘广鸿

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

SQLALCHEMY_DATABASE_URL = 'mysql+pymysql://smartHome_admin:smartHome_root@localhost/smartHome_ByZX'
# SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"

engine = create_engine(
    SQLALCHEMY_DATABASE_URL, encoding='utf8', echo=True, pool_size=20, max_overflow=0, pool_pre_ping=True
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
# session = SessionLocal()
Base = declarative_base()
